//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "common\fn_deleteGroup.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
private ["_grp"];
_grp = _this;
if (typeName _this == typeName []) then { _grp = _this select 0; };
if !(isNull _grp) then {
	if (count(units _grp) > 0) then {
		{ deleteVehicle _x;
		} foreach units _grp;
	};
	if !(isNil "SERVER") then {
		_recycled = SERVER getVariable [QGVAR(RECYCLED_GROUPS_) + str(side _grp),[]];
		_grp setVariable [QGVAR(RECYCLED),time + 1800, true];
		_recycled set [count _recycled, _grp];
		SERVER setVariable [QGVAR(RECYCLED_GROUPS_) + str(side _grp),_recycled,true];
		TRACE("Recycled");
	} else {
		deleteGroup _grp;
		TRACE("Deleted");
	};
};